package com.springcloud.sleuth.controller;

import brave.Tracer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Desc:
 * @Date: 2020-06-27
 * @Version:v1.0
 */
@RestController
public class HelloController {

    @Autowired
    private Tracer tracer;

    @Value("${server.port}")
    private String port;

    @GetMapping("/hello")
    public String sayHello(@RequestParam(value = "name", defaultValue = "sspringcloud-sleuth") String name) {
        tracer.currentSpan().tag("name", "foreap");
        return "hello, this is sleuth client, port:" + port;
    }
}
